<template>
	<view class="look">
		<view class="" style="border: 2rpx solid #f8f8f8;"></view>
		<view class="list">
			<view class="list-item" v-for="item in applyList" :key="item.id">
				<view class="left">
					申请物品：{{item.thing_name}}
				</view>
				<view class="right">
					<u-button :type="typeColor[item.approval_status]" shape="circle" size="mini" :plain="true"
						:ripple="true">
						{{item.approval_status | getStatus}}
					</u-button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				applyList: [],
				typeColor: ['info', 'primary', 'error', 'success']
			}
		},
		filters: {
			getStatus(status) {
				const arr = ['审核中', '已通过', '已驳回', '评测完成']
				return arr[status]
			}
		},
		methods: {
			initData() {
				this.$u.api.getUserDeatil(this.vuex_user.id).then(res => {
					this.applyList = res.data.Applies
					uni.stopPullDownRefresh()
				})
			}
		},
		onShow() {
			this.initData()
		},
		onPullDownRefresh() {
			this.initData()
		}
	}
</script>

<style scope lang="scss">
	.look {
		background-color: #f8f8f8;
		min-height: 100vh;

		.list {
			margin: 40rpx;

			.list-item {
				margin-bottom: 20rpx;
				background-color: #fff;
				padding: 20rpx;
				border-radius: 20rpx;
				border: 2rpx solid #eee;
				display: flex;
				justify-content: space-between;
			}
		}
	}
</style>
